home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / NET / IRDA / IROBEX.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  115 lines

  1. /*********************************************************************
  2.  *                
  3.  * Filename:      irobex.h
  4.  * Version:       0.8
  5.  * Description:   
  6.  * Status:        Experimental.
  7.  * Author:        Dag Brattli <dagb@cs.uit.no>
  8.  * Created at:    Sat Jul  4 22:43:57 1998
  9.  * Modified at:   Thu Mar 11 16:11:54 1999
  10.  * Modified by:   Dag Brattli <dagb@cs.uit.no>
  11.  * 
  12.  *     Copyright (c) 1998 Dag Brattli, All Rights Reserved.
  13.  *      
  14.  *     This program is free software; you can redistribute it and/or 
  15.  *     modify it under the terms of the GNU General Public License as 
  16.  *     published by the Free Software Foundation; either version 2 of 
  17.  *     the License, or (at your option) any later version.
  18.  *  
  19.  *     Neither Dag Brattli nor University of Troms° admit liability nor
  20.  *     provide warranty for any of this software. This material is 
  21.  *     provided "AS-IS" and at no charge.
  22.  *     
  23.  ********************************************************************/
  24.  
  25. #ifndef IROBEX_H
  26. #define IROBEX_H
  27.  
  28. #include <linux/kernel.h>
  29. #include <linux/types.h>
  30. #include <linux/skbuff.h>
  31. #include <linux/miscdevice.h>
  32.  
  33. #include <net/irda/timer.h>
  34. #include <net/irda/qos.h>
  35. #include <net/irda/irmod.h>
  36.  
  37. #define LOW_THRESHOLD      4
  38. #define HIGH_THRESHOLD     8
  39. #define IROBEX_MAX_QUEUE  12
  40.  
  41. /* Small structure to be used by the IOCTL call */
  42. struct irobex_ioc_t {
  43.      __u32 daddr;
  44. };
  45.  
  46. #define IROBEX_IOC_MAGIC 'k'
  47.  
  48. #define IROBEX_IOCSCONNECT    _IOW(IROBEX_IOC_MAGIC, 1, 4)
  49. #define IROBEX_IOCSDISCONNECT _IOW(IROBEX_IOC_MAGIC, 2, 4)
  50. #define IROBEX_IOC_MAXNR 2
  51.  
  52. #define IROBEX_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_HEADER)
  53.  
  54. typedef enum {
  55.     OBEX_IDLE,       /* Doing nothing */
  56.     OBEX_DISCOVER,   /* Trying to discovery remote device */
  57.     OBEX_QUERY,      /* Querying remote LM-IAS */
  58.     OBEX_CONN,       /* Trying to connect to remote device */
  59.     OBEX_DATA,       /* Data transfer ready */
  60. } OBEX_STATE;
  61.  
  62. struct irobex_cb {
  63.     QUEUE queue;        /* Must be first! */
  64.  
  65.         int magic;          /* magic used to detect corruption of the struct */
  66.  
  67.     OBEX_STATE state;   /* Current state */
  68.  
  69.     __u32 saddr;        /* my local address */
  70.     __u32 daddr;        /* peer address */
  71.     unsigned long time_discovered;
  72.  
  73.     __u32 ckey;           /* IrLMP client handle */
  74.     __u32 skey;           /* IrLMP service handle */
  75.  
  76.         char devname[9];    /* name of the registered device */
  77.     struct tsap_cb *tsap;
  78.     int eof;
  79.  
  80.     __u8 dtsap_sel;         /* remote TSAP address */
  81.     __u8 stsap_sel;         /* local TSAP address */
  82.  
  83.     int irlap_data_size;
  84.  
  85.     struct miscdevice dev;
  86.  
  87.     int count;                /* open count */
  88.  
  89.     struct sk_buff_head rx_queue; /* Receive queue */
  90.  
  91.     struct wait_queue *read_wait;
  92.     struct wait_queue *write_wait;
  93.  
  94.     struct fasync_struct *async;
  95.  
  96.     struct timer_list watchdog_timer;
  97.  
  98.     LOCAL_FLOW tx_flow;
  99.     LOCAL_FLOW rx_flow;
  100. };
  101.  
  102. int irobex_init(void);
  103.  
  104. void irobex_watchdog_timer_expired( unsigned long data);
  105.  
  106. inline void irobex_start_watchdog_timer( struct irobex_cb *self, int timeout) 
  107. {
  108.     irda_start_timer( &self->watchdog_timer, timeout, (unsigned long) self,
  109.               irobex_watchdog_timer_expired);
  110. }
  111.  
  112. extern struct irobex_cb *irobex;
  113.  
  114. #endif
  115.